﻿// License: https://opensource.org/licenses/MIT
// Create Date : 2018-01-01

using System;

namespace Cat.Core.XLog
{
    /// <summary>
    /// 空ILogger，不会进行任何Log操作
    /// </summary>
    sealed class NullLogger : LoggerBase, ILogger
    {
        public static ILogger Instance { get; } = new NullLogger();

        public override void SetIsDebugEnabled(bool enable) { }
        public override void SetIsInfoEnabled(bool enable) { }
        public override void SetIsWarnEnabled(bool enable) { }
        public override void SetIsErrorEnabled(bool enable) { }
        public override void SetIsFatalEnabled(bool enable) { }

        private NullLogger()
        {
            base.SetIsDebugEnabled(false);
            base.SetIsInfoEnabled(false);
            base.SetIsWarnEnabled(false);
            base.SetIsErrorEnabled(false);
            base.SetIsFatalEnabled(false);
        }

        protected override void Log(LogLevel level, Exception exception, Lazy<string> message)
        {
            //不做任何操作
        }
    }
}
